package com.xinchao.job.task;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.util.StopWatch;

import com.xinchao.job.service.DeviceOffLineJobService;


/**
 * 
 * <p>Title: DeviceOffLineJob</p>  
 * <p>Description: 当前任务定时扫描终端表，将超过一定时间未上报信息（超时时间作为配置项，超过该时间段未上报则修改终端状态为离线）</p>  
 * @author huangf 
 * @date 2018年5月11日
 */
@DisallowConcurrentExecution
public class DeviceOffLineJob extends QuartzJobBean{
	private static Logger logger = LoggerFactory.getLogger(DeviceOffLineJob.class);
	
	@Autowired
	private DeviceOffLineJobService deviceOffLineJobService;
	@Override
	protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
		StopWatch stopWatch = new StopWatch();  
		stopWatch.start();
		deviceOffLineJobService.deviceOffLine();
		stopWatch.stop();
		logger.info("【DeviceOffLineJob】执行完毕，执行时间："+stopWatch.getTotalTimeSeconds());
	}

}